package org.jiangy.usercenter.entity;

import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;

/**
 * <p>创建时间: 2024/8/15 </p>
 *
 * @author <a href="mailto:jiangliu0316@outlook.com" rel="nofollow">蒋勇</a>
 */
@Converter
public class UserTypeConverter implements AttributeConverter<UserTypeEnum, String> {

    @Override
    public String convertToDatabaseColumn(UserTypeEnum attribute) {
        return attribute.name();
    }

    @Override
    public UserTypeEnum convertToEntityAttribute(String dbData) {
        return UserTypeEnum.valueOf(dbData);
    }
}
